﻿using System;

namespace problem
{
    class Program
    {
        static void Main(string[] args)
        {
            test4();
        }
        //九九乘法表

        //1 * 1 = 1	
        //2 * 1 = 2	2 * 2 = 4	
        //3 * 1 = 3	3 * 2 = 6	3 * 3 = 9	
        //4 * 1 = 4	4 * 2 = 8	4 * 3 = 12	4 * 4 = 16	
        //5 * 1 = 5	5 * 2 = 10	5 * 3 = 15	5 * 4 = 20	5 * 5 = 25	
        //6 * 1 = 6	6 * 2 = 12	6 * 3 = 18	6 * 4 = 24	6 * 5 = 30	6 * 6 = 36	
        //7 * 1 = 7	7 * 2 = 14	7 * 3 = 21	7 * 4 = 28	7 * 5 = 35	7 * 6 = 42	7 * 7 = 49	
        //8 * 1 = 8	8 * 2 = 16	8 * 3 = 24	8 * 4 = 32	8 * 5 = 40	8 * 6 = 48	8 * 7 = 56	8 * 8 = 64	
        //9 * 1 = 9	9 * 2 = 18	9 * 3 = 27	9 * 4 = 36	9 * 5 = 45	9 * 6 = 54	9 * 7 = 63	9 * 8 = 72	9 * 9 = 81	

        static void test()
        {
            string[,] arr = new string[9, 9];

            for (int i = 1; i < arr.GetLength(0); i++)
            {

                for (int j = 1; j <= i; j++)

                {
                    arr[i, j] = (i + 1) + "*" + (j + 1) + "=" + (i + 1) * (j + 1) + "\t";
                }

            }
            for (int i = 1; i < arr.GetLength(0); i++)
            {
                for (int j = 0; j < arr.GetLength(1); j++)
                {
                    Console.Write(arr[i, j]);

                }
                Console.WriteLine();
            }


        }
        /* 用户输入正方形边长，用* 打印出实心正方形。

         如：用户输入5，则输出如下图形。
            *****
            *****
            *****
            *****
            ***** */
        static void test1()
        {
            Console.WriteLine("请输入正方形边长：");
            int arr = int.Parse(Console.ReadLine());
            for (int i = 0; i < arr; i++)
            {
                for (int j = 0; j < arr; j++)

                    Console.Write("*");


                Console.WriteLine();

            }
            Console.ReadKey();
        }

        //        用户输入正方形边长，用* 打印出空心正方形。

        //如：用户输入5，则输出如下图形。
        //* * * * *
        //*       *
        //*       *
        //*       *
        //* * * * *
        static void test2()
        {
            Console.WriteLine("请输入正方形边长：");
            int a = int.Parse(Console.ReadLine());
            string[,] arr = new string[a, a];
            for (int i = 0; i < arr.GetLength(0); i++)
            {
                for (int j = 0; j < arr.GetLength(1); j++)
                {
                    arr[i, j] = "*" + " ";
                }
            }
            for (int i = 0; i < arr.GetLength(0); i++)
            {
                for (int j = 0; j < arr.GetLength(1); j++)
                {
                    if (i == 0 || j == 0 || i == arr.GetLength(0) - 1 || j == arr.GetLength(1) - 1)
                    {
                        Console.Write("*");
                    }
                    else
                    {
                        Console.Write(" ");
                    }
                    Console.WriteLine();
                }
            }
        }
        //  *
        // ***
        //*****
        // ***
        //  *

        //边长是3
        //行列数就是5
        static void test3()
        {
            Console.WriteLine("请输入奇数：");
            int x = Convert.ToInt32(Console.ReadLine());
            for (int i = 1; i <= (x + 1) / 2; i++)

            {
                for (int j = (x - 1) / 2; j >= i; j--)
                {
                    Console.Write(" ");
                }
                for (int b = 1; b <= i * 2 - 1; b++)
                {
                    Console.Write("* ");
                }
                Console.WriteLine();
            }
            for (int i = (x - 1) / 2; i >= 1; i--)
            {
                for (int j = i - 1; j < (x - 1) / 2; j++)
                {
                    Console.Write(" ");
                }
                for (int b = 1; b <= i * 2 - 1; b++)
                {
                    Console.Write("*");
                }
                Console.WriteLine();

            }
        }
        //如果一个数组保存元素是有序的（从大到小），向这个数组中插入一个数，使得插入后的数组元素仍然保持有序。

        static void test4()
        {
            {
                int[] arr = { 10, 8, 6, 4, 2 };
                int[] crr = new int[6];
                Console.WriteLine("输入一个数");
                int brr = int.Parse(Console.ReadLine());
                for (int i = 0; i < arr.Length; i++)
                {
                    crr[i] = arr[i];
                }
                crr[5] = brr;
                Array.Sort(crr);
                Array.Reverse(crr);
                for (int i = 0; i < crr.Length; i++)
                {
                    Console.Write(crr[i] + " ");
                }
            }
        }

    }
}

